﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LotteryVote.Logic.Web;
using LotteryVote.Logic;

namespace LotteryVote.Controls
{
    public partial class AmountBoard : MemberControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindAmount();
        }

        void BindAmount()
        {
            ltl_totalAmount.Text = CurrentUser.UserInfo.AvailableGivenCredit.ToString("#,##0");
        }
        public string GetFreezeFund()
        {
            return Execute(() =>
            {
                FreezeFundsFacade blFreezeFund = new FreezeFundsFacade();
                var freezeFund = blFreezeFund.GetFreezeFund(CurrentUser.UserId);
                return freezeFund == null ? "0" : freezeFund.Amount.ToString("#,##0");
            });
        }
    }
}